home *** CD-ROM | disk | FTP | other *** search
/ Visual FX for Image FX / VisualFX for Image FX 3.adf / Files / ARexx / 03 / 11.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-07-31  |  4.7 KB  |  224 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20. line = readln(TempFile)
  21. PicAName = strip(line)
  22. line = readln(TempFile)
  23. Start = strip(line)
  24. line = readln(TempFile)
  25. End = strip(line)
  26. line = readln(TempFile)
  27. IAType = strip(line)
  28. line = readln(TempFile)
  29. FlareNum = strip(line)
  30. do i = 1 to FlareNum
  31.     Answer.i = readln(TempFile)
  32.     parse var Answer.i X1.i Y1.i X2.i Y2.i
  33.     line = readln(TempFile)
  34.     Size.i = strip(line)
  35.     line = readln(TempFile)
  36.     PathType.i = strip(line)
  37.     line = readln(TempFile)
  38.     LensType.i = strip(line)
  39.     end
  40. call close TempFile
  41.  
  42. Frames = (End - Start)+1
  43. j=0
  44. k=0
  45. TFrames = Frames
  46. TNum = 3
  47. if TFrames > 999 then TNum = 4
  48. if TFrames > 9999 then TNum = 5
  49. if Field = 1 then TFrames = Frames*2
  50. do i = Start to End
  51.     k = k+ 1
  52.     call open TempFile,"RAM:VFXNums",W
  53.     call writeln TempFile,right(k,5,'0')
  54.     call writeln TempFile,right(Frames,5,'0')
  55.     call close TempFile
  56.     f=0
  57.     Redraw Off
  58.     j = j+ 1
  59.     FieldSet = 0
  60.     call DoIt()
  61.     Redraw On
  62.     call SaveIt()
  63.         if Field = 1 then do
  64.             Redraw Off
  65.             j = j + 1
  66.             FieldSet = 1
  67.             call DoIt()
  68.             Redraw On
  69.             call SaveIt()
  70.             end 
  71.     end
  72.     Undo On
  73. exit
  74.  
  75.  
  76.  
  77. LoadA:
  78.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  79.         Undo On
  80.         exit
  81.         end
  82.     if IAType = 0 then do
  83.         LoadBuffer PicAName Force i
  84.         if Field = 1 then do
  85.             GetMain
  86.             parse var result Name Width Height Blah
  87.             if FieldSet = 0 then do
  88.                 Hook DeInterlace
  89.                 Scale Width Height
  90.                 end
  91.             if FieldSet = 1 then do
  92.                 Hook DeInterlace
  93.                 Swap
  94.                 Scale Width Height
  95.                 end
  96.             end
  97.         end
  98.     if IAType = 1 then do
  99.         LoadBuffer PicAName Force 1
  100.         end
  101.     if IAType = 2 then do
  102.         LoadBuffer PicAName Force
  103.         end
  104.     if IAType = 3 then do
  105.         LoadBuffer PicAName""right(i,TNum,'0') Force
  106.         end
  107. return
  108.  
  109.  
  110. GetPathCords:
  111.     PathFile = "VFXIFX:TempDrawer/DrawNum."FXNum"."right(FNum,2,'0')
  112.     PathNum = trunc(((j-1) * Answer.FNum)/(TFrames-1))
  113.     if PathNum < 1 then PathNum = 1
  114.     call open TempFile,PathFile,R
  115.     do ii = 1 to PathNum
  116.         line = readln(TempFile)
  117.         end
  118.     parse var line MyX.FNum" "MyY.FNum
  119.     call close TempFile
  120. return
  121.  
  122. GetXYCords:
  123.     FrameNum = j
  124.     TotalNum = TFrames
  125.  
  126.     TotalKey = 1
  127.     NumKey = (TotalNum/TotalKey)
  128.     FirstNum = ((NumKey - (NumKey-(FrameNum-1)))%NumKey)+1
  129.     SecNum = FirstNum+1
  130.     if FirstNum = TotalKey then do
  131.         NumKey = NumKey - 1
  132.         NewNum = (((FrameNum-((FirstNum-1)*NumKey)))-(TotalKey-1))
  133.         end
  134.     else 
  135.         NewNum = ((FrameNum-((FirstNum-1)*NumKey)))
  136.     if X2.FNum < X1.FNum then do
  137.         DiffX = -((X1.FNum-X2.FNum)/(NumKey))
  138.         end
  139.     else do
  140.         DiffX = ((X2.FNum-X1.FNum)/(NumKey))
  141.         end
  142.     if Y2.FNum < Y1.FNum then do
  143.         DiffY = -((Y1.FNum-Y2.FNum)/(NumKey))
  144.         end
  145.     else do
  146.         DiffY = ((Y2.FNum-Y1.FNum)/(NumKey))
  147.         end
  148.     MyX.FNum = (X1.FNum + (DiffX*NewNum))-DiffX
  149.     MyY.FNum = (Y1.FNum + (DiffY*NewNum))-DiffY
  150.     MyX.FNum = MyX.FNum % 1
  151.     MyY.FNum = MyY.FNum % 1
  152. return
  153.  
  154. SaveIt:
  155.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  156.         Undo On
  157.         exit
  158.         end
  159.     if SaveType = 0 then do
  160.         call Switcher(TOSW)
  161.         call Switcher(MDV1)
  162.  
  163.         Render Go
  164.         if Field = 1 then
  165.                 call RecordAdd(SaveName,1,6,Compression)
  166.         else
  167.                 call RecordAdd(SaveName,2,6,Compression)
  168.         if j = TFrames then
  169.             call MakeIcon(SaveName,(Frames-10))
  170.         end
  171.  
  172.     if SaveType = 1 then do
  173.         if Field = 1 then do
  174.             f= f + 1
  175.             if f = 1 then
  176.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  177.             if f = 2 then do
  178.                 GetMain
  179.                 parse var result Name Width Height Blah
  180.                 Scale Width Height/2
  181.                 Swap
  182.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  183.                 Scale Width Height/2
  184.                 Hook Interlace
  185.                 SaveBufferAs ILBM SaveName""right(k,TNum,'0')
  186.                 f = 0
  187.                 end
  188.             end
  189.         else do
  190.             SaveBufferAs ILBM SaveName""right(k,TNum,'0')
  191.             end    
  192.         end
  193.  
  194.  
  195. return
  196.  
  197.  
  198. DoIt:
  199.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  200.         Undo On
  201.         exit
  202.         end
  203.     call LoadA()
  204.  
  205.     do FNum = 1 to FlareNum
  206.         if PathType.FNum = 0 then call GetXYCords()
  207.         if PathType.FNum = 1 then call GetPathCords()
  208.         parse var LensType.FNum Blah" "Blah2" "FileSet" "TypeSet" "Radius" "Bright" "CenterX" "CenterY" "Rest
  209.         if Blah2 = "RadialStar" then do
  210.             parse var LensType.FNum Blah" "Blah2" "SetA" "SetB" "SetC" "SetD" "SetE" "SetF" "SetG" "SetH" "SetI
  211.             RDegree = trunc(((j-1) * 360)/(TFrames-1))
  212.             RunMe = "Hook RadialStar "Size.FNum" "SetB" "SetC" "RDegree" "SetE" "SetF" "MyX.FNum" "MyY.FNum" "SetI
  213.             end
  214.         else do
  215.             RunMe = "Hook LensFlare "FileSet" "TypeSet" "Size.FNum" "Bright" "MyX.FNum" "MyY.FNum" "Rest
  216.             end
  217.         RunMe
  218.         end
  219.  
  220. return
  221.  
  222.  
  223.  
  224.